package model.admin;

import java.util.ArrayList;

import vo.BatchDetailsVo;

import com.opensymphony.xwork2.ActionSupport;

public class ModifyBatchMo extends ActionSupport {
	ArrayList<BatchDetailsVo> batch_list;
	BatchDetailsVo new_batch;
	int batch_id;
	String batch_name;
	String start_date;
	String end_date;
	int student_count;
	int start_year;
	int incharge_id;
	public ArrayList<BatchDetailsVo> getBatch_list() {
		return batch_list;
	}

	public void setBatch_list(ArrayList<BatchDetailsVo> batch_list) {
		this.batch_list = batch_list;
	}

	String description;

	public BatchDetailsVo getNew_batch() {
		return new_batch;
	}

	public void setNew_batch(BatchDetailsVo new_batch) {
		this.new_batch = new_batch;
	}

	public int getBatch_id() {
		return batch_id;
	}

	public void setBatch_id(int batch_id) {
		this.batch_id = batch_id;
	}

	public String getBatch_name() {
		return batch_name;
	}

	public void setBatch_name(String batch_name) {
		this.batch_name = batch_name;
	}

	public String getStart_date() {
		return start_date;
	}

	public void setStart_date(String start_date) {
		this.start_date = start_date;
	}

	public String getEnd_date() {
		return end_date;
	}

	public void setEnd_date(String end_date) {
		this.end_date = end_date;
	}

	public int getStudent_count() {
		return student_count;
	}

	public void setStudent_count(int student_count) {
		this.student_count = student_count;
	}

	public int getStart_year() {
		return start_year;
	}

	public void setStart_year(int start_year) {
		this.start_year = start_year;
	}

	public int getIncharge_id() {
		return incharge_id;
	}

	public void setIncharge_id(int incharge_id) {
		this.incharge_id = incharge_id;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public String execute() throws Exception {
		return SUCCESS;
	}

	public String submitNewBatch() throws Exception {
		GetBatchListMo BatchListObject= new GetBatchListMo();
		setBatch_list(BatchListObject.getBatchList());
		
		
		BatchDetailsVo newBatch = new BatchDetailsVo();
		newBatch.setBatch_name(getBatch_name());
		newBatch.setDescription(getDescription());
		newBatch.setIncharge_id(getIncharge_id());
		newBatch.setEnd_date(getEnd_date());
		newBatch.setStart_date(getStart_date());
		newBatch.setStart_year(getStart_year());
		newBatch.setStudent_count(getStudent_count());

		ModifyBatchDetails new_object = new ModifyBatchDetails();
		int res=new_object.addBatchDetails(newBatch,"Add Batch");
		if(res==1)
		return SUCCESS;
		else return ERROR;
	}
}
